package similan.br18.service;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;

import similan.br18.domain.Contact;
import similan.br18.domain.Group;
import similan.br18.domain.TagType;

@ManagedBean
@ApplicationScoped
public class GroupService implements Serializable {

	private static final long serialVersionUID = 2558671420934477168L;

	public List<Group> getGroupsBy(Contact contact, TagType tagType) {
		List<Group> groups = new ArrayList<Group>();
		int size = new Random().nextInt(10)+1;
		for (int i = 0; i < size; i++) {
			Group group = new Group();
			group.setName(tagType.name() + "_" + i);
			group.setTagType(tagType);
			groups.add(group);
		}

		return groups;
	}
}
